﻿namespace DeltaGroup.WheelOfJeopardy.ChallengeManager
{
    using System.Collections.Generic;

    using DeltaGroup.WheelOfJeopardy.Model;

    /// <summary>
    /// 
    /// </summary>
    public sealed class StrictStrategy : InterpreterStrategy
    {
        #region Methods

        /// <summary>
        /// Evaluates the response using strict rules. No synonyms are used and all key tokens must match.
        /// </summary>
        /// <param name="challenge">The challenge.</param>
        /// <param name="responseString">The response string.</param>
        /// <returns></returns>
        public override bool EvaluateResponse(Challenge challenge, string responseString)
        {
            bool acceptableResponse;

            acceptableResponse = ExactCheck(challenge.ExpectedResponse, responseString);
            if (!acceptableResponse)
            {
                Phrase expectedResponse = new Phrase(challenge.ExpectedResponse, StopWordList);
                Phrase actualResponse = new Phrase(responseString, StopWordList);

                acceptableResponse = OrderedTokenCheck(expectedResponse, actualResponse);
            }

            return acceptableResponse;
        }

        #endregion Methods
    }
}